﻿namespace SupportSystemUI.Controls.CustomPages.Crew
{
    using System.Collections.Generic;
    using System.Windows.Controls;
    using SupportSystemDB;
    using SupportSystemUI.Controls.Utility.Other;

    /// <summary>
    /// Interaction logic for UserProfile.xaml
    /// </summary>
    public partial class UserProfile : UserControl
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="UserProfile"/> class.
        /// </summary>
        /// <param name="member">Member object to display its data.</param>
        /// <param name="contacts">Contacts list for this member.</param>
        /// <param name="positions">Positions list for this member.</param>
        public UserProfile(vMember member, List<vContact> contacts, List<vParticipate> positions)
        {
            this.InitializeComponent();
            this.profileImage.SetImage(member.LargeImage);

            this.personalInfo.Children.Add(new ListItem("Current Position", member.PositionName));
            this.personalInfo.Children.Add(new ListItem("Gender", member.Gender == 0 ? "Male" : "Female"));
            this.personalInfo.Children.Add(new ListItem("College", member.CollegeName));
            this.personalInfo.Children.Add(new ListItem("University", member.UniversityName));
            this.personalInfo.Children.Add(new ListItem("Academic Year", member.AcademicYear));
            this.personalInfo.Children.Add(new ListItem("Birthday", member.BirthDate.ToString()));

            foreach (vContact c in contacts)
            {
                this.contactInfo.Children.Add(new ListItem(c.Type, c.Value));
            }

            foreach (vParticipate p in positions)
            {
                this.positionsInfo.Children.Add(new ListItem(
                    p.EventName,
                    p.CommitteeName + " " + p.PositionName));
            }
        }
    }
}
